package util;

        import lombok.extern.slf4j.Slf4j;

        import javax.servlet.ServletException;
        import javax.servlet.annotation.WebServlet;
        import javax.servlet.http.HttpServlet;
        import javax.servlet.http.HttpServletRequest;
        import javax.servlet.http.HttpServletResponse;
        import java.io.IOException;

@WebServlet(urlPatterns = {"/initServlet"}, loadOnStartup = 0)
@Slf4j
public class InitServlet extends HttpServlet {
    @Override
    public void init() throws ServletException {
        log.debug("HEREEEE");
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doGet(request, response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.getServletContext().setAttribute("root", request.getContextPath());
        log.debug("In initServlet, request.getContextPath()=" + request.getContextPath());
    }
}
